<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>跳转页面</title>
</head>
<body>
  <h2>请选择跳转目标</h2>
  <form id="redirectForm" onsubmit="handleSubmit(event)">
    <input type="text" id="userInput" placeholder="输入信息">
    <button type="submit">跳转</button>
  </form>

  <script>
    function handleSubmit(event) {
      event.preventDefault();
      const input = document.getElementById('userInput').value;
      const form = document.getElementById('redirectForm');
      
      if (input === 'A') {
        form.action = 'https://example.com/pageA';
      } else if (input === 'B') {
        form.action = 'https://example.com/pageB';
      } else {
        alert('无效输入，请输入A或B');
        return;
      }
      form.submit();
    }
  </script>
</body>
</html>
